/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.common.service.base;

import cn.hutool.core.util.StrUtil;
import org.noear.solon.Solon;
import org.noear.solon.SolonProps;
import org.noear.solon.annotation.Component;

/**
 * <b>(ProfileConfig)</b>
 * 判断当前环境
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/4/27
 */
@SuppressWarnings("unused")
@Component
public class ProfileConfig {

    private SolonProps solonProps;

    private SolonProps get() {
        if (solonProps == null) {
            solonProps = Solon.cfg();
        }
        return solonProps;
    }

    public boolean isDev() {
        return StrUtil.equalsAnyIgnoreCase(get().env(), "dev");
    }

    public boolean isTest() {
        return StrUtil.equalsAnyIgnoreCase(get().env(), "test");
    }

    public boolean isProd() {
        return StrUtil.equalsAnyIgnoreCase(get().env(), "prod");
    }

    public boolean isMock() {
        return StrUtil.equalsAnyIgnoreCase(get().env(), "mock");
    }

}